package com.beerandjesus.calc.bean;

import com.beerandjesus.calc.AbstractTrackSplitter;

/**
 * Takes input and prepares output of album track names and their
 * associated times.
 *
 * Adds track times together to supply expected stop points for splitting
 * full-album audio files into individual tracks.
 *
 * Parsing classes provide support for different formats of input.
 *
 * Date: Jan 27, 2008
 * Time: 4:12:51 PM
 */
public class CalculatorBean extends AbstractTrackSplitter {

    public String prepareOutput() {
        StringBuffer sb = new StringBuffer();
        sb.append("<table>\n");
        for (int i = 0; i < getTrackNames().size(); i++) {
            sb.append("<tr>\n<td>");
            sb.append(getStops().get(i)).append("</td><td>").append(getTrackNames().get(i)).append("</td>\n</tr>\n");
        }
        sb.append("</table>\n");
        return sb.toString();
    }

    public String prepareOutputForBoth() {
        if (isDebug()) {
            getTracks().setDebug(true);
        }
        StringBuffer sb = new StringBuffer();
        sb.append("<table>\n").append("<tr>\n").append("<td>\n");
        sb.append(getTracks().getHTMLTrackList());
        sb.append("</td>\n<td>\n");
        sb.append(getTracks().getHTMLTimeList());
        sb.append("</td>\n</tr>\n</table>\n");
        return sb.toString();
    }

}
